import request from '@/utils/request'
/*
 * 考试详情
 */
export function getExamInfo(id) {
  return request({
    url: '/exam/info',
    method: 'post',
    data:{
    	id
    }
    
  })
}

/*
 * 考试试卷
 * 	paperId:试卷ID
 */
export function getExamPaper(paperId) {
  return request({
    url: '/exam/paper',
    method: 'post',
    data:{
    	paperId
    }
    
  })
}

/*
 * 创建考试记录
 * 	userId:用户ID
	examId:考试ID
	paperId:试卷ID
	paperName:试卷名字
	type:考试形式：COURSE课后测试，TASK培训任务考试， EXAM 正常考试
	
	
 */
export function createExamRecord(data) {
  return request({
    url: '/exam/createExamRecord',
    method: 'post',
    data:data,
    
    
  })
}

/*
 * 交卷
 * 
	id:考试记录ID，创建考试记录接口返回的
userId:用户id
examId:考试
time:用时（秒）
questionRecords:数组[{answer:答案,score:分值,question:{试题对象}}]

headers 请求头

 */
export function submitExam(data,headers) {
  return request({
    url: '/exam/submit',
    method: 'post',
    data:data,
    headers:headers
    
    
  })
}

/*
 * 考试结果(用时，分数，及格)
 * userId:用户ID
	examId:考试ID
	type:考试形式：COURSE课后测试，TASK培训任务考试， EXAM 正常考试
 */
export function getExamReport(data) {
  return request({
    url: '/exam/getExamReport',
    method: 'post',
    data:data,
  })
}

/*
 * 考试解析
 * examRecordId:考试记录ID
paperId:试卷ID
status: Boolean类型 false:查看错题解析 true：全部解析
 */
export function getExamRecord(data) {
  return request({
    url: '/exam/getExamRecord',
    method: 'post',
    data:data,
  })
}